<template>
  <div>
    <a-table
      ref="table"
      size="middle"
      bordered
      rowKey="id"
      :columns="columns1"
      :dataSource="dataSource"
      :pagination="ipagination"
      :loading="loading"
      @change="handleTableChange"
    >
    <template v-slot:complateAdvice="text">
       <j-ellipsis :value="text" :length="10"/>
    </template>
      <span slot="action" slot-scope="text, record">
        <!-- <a-icon type="vertical-align-bottom" @click="handleDownloadFile(record.url)"></a-icon> -->
        <a @click="handleToDetail(record)">查看</a>
      </span>
    </a-table>
  </div>
</template>

<script>
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { columns1 } from './indexColumns'
export default {
  mixins: [JeecgListMixin],
  data() {
    return {
      columns1: columns1(this),
      dataSource: [],
      url: {
        list: '/sjdb/sjDaiban/queryDbList',
      },
      //   disableMixinCreated: true,
    }
  },
  created() {
    this.queryParam.state = 1
  },
  methods: {
    handleDownloadFile(fileUrl) {
      this.$message.success('正在下载，请稍等！')
      let url = `${window._CONFIG['domianURL']}/sys/common/download/${fileUrl}`
      window.open(url, '_blank')
    },
    handleToDetail(record) {
      // console.log(record, 'record')
      // const regex = /\[(.+?)\]/g //获取中括号内容
      // const key = regex.exec(record.title)[1]
      // const routerName = record.stagename.split('-')[0]

      if (record.href) {
        this.$router.push(record.href)
        this.$emit('closed')
      } else {
        this.$message.error('未找到该路径！')
      }
    },
  },

  //   watch: {
  //     planId: {
  //       handler(val) {
  //         this.url.list = `${this.url.list}?planId=${val}&fileType=yearPlan`
  //         this.loadData()
  //       },
  //       deep: true,
  //       immediate: true,
  //     },
  //   },
}
</script>

<style>
</style>